# 设置项目根目录
$PROJECT_ROOT = "F:\shopping"

Write-Host "========================================" -ForegroundColor Green
Write-Host "   电商平台微服务启动脚本（仅启动服务）" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Green
Write-Host ""

Write-Host "正在启动服务..." -ForegroundColor Yellow
Write-Host ""

# 启动auth-service
Write-Host "启动auth-service..." -ForegroundColor Cyan
Start-Process cmd.exe -ArgumentList "/k", "chcp 65001 >nul && cd /d $PROJECT_ROOT\auth-service && java -jar target\auth-service-1.0.0.jar" -WindowStyle Normal
Start-Sleep -Seconds 5

# 启动user-service
Write-Host "启动user-service..." -ForegroundColor Cyan
Start-Process cmd.exe -ArgumentList "/k", "chcp 65001 >nul && cd /d $PROJECT_ROOT\user-service && java -jar target\user-service-1.0.0.jar" -WindowStyle Normal
Start-Sleep -Seconds 5

# 启动product-service
Write-Host "启动product-service..." -ForegroundColor Cyan
Start-Process cmd.exe -ArgumentList "/k", "chcp 65001 >nul && cd /d $PROJECT_ROOT\product-service && java -jar target\product-service-1.0.0.jar" -WindowStyle Normal
Start-Sleep -Seconds 5

# 启动order-service
Write-Host "启动order-service..." -ForegroundColor Cyan
Start-Process cmd.exe -ArgumentList "/k", "chcp 65001 >nul && cd /d $PROJECT_ROOT\order-service && java -jar target\order-service-1.0.0.jar" -WindowStyle Normal
Start-Sleep -Seconds 5

# 启动gateway-service
Write-Host "启动gateway-service..." -ForegroundColor Cyan
Start-Process cmd.exe -ArgumentList "/k", "chcp 65001 >nul && cd /d $PROJECT_ROOT\gateway-service && java -jar target\gateway-service-1.0.0.jar" -WindowStyle Normal

Write-Host ""
Write-Host "========================================" -ForegroundColor Green
Write-Host "   所有服务已启动！" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Green
Write-Host ""
Write-Host "服务端口：" -ForegroundColor Yellow
Write-Host "- auth-service:    通常为8081" -ForegroundColor White
Write-Host "- user-service:    通常为8082" -ForegroundColor White
Write-Host "- product-service: 通常为8083" -ForegroundColor White
Write-Host "- order-service:   通常为8084" -ForegroundColor White
Write-Host "- gateway-service: 通常为8080" -ForegroundColor White
Write-Host ""
Write-Host "按任意键退出..." -ForegroundColor Yellow
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")